home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / tutor / tutor.vim < prev    next >
Encoding:
Text File  |  2001-08-11  |  1.3 KB  |  51 lines

  1. " Vim tutor support file
  2. " Author: Eduardo F. Amatria <eferna1@platea.pntic.mec.es>
  3. " Last Change:    2001 Aug 11
  4.  
  5. " This small source file is used for detecting if a translation of the
  6. " tutor file exist, i.e., a tutor.xx file, where xx is the language.
  7. " If the translation does not exist, or no extension is given,
  8. " it defaults to the english version.
  9.  
  10. " It is invoked by the vimtutor shell script.
  11.  
  12. " 1. Build the extension of the file, if any:
  13. let s:ext = ""
  14. if strlen($xx) > 1
  15.   let s:ext = "." . $xx
  16. elseif exists("v:lang") && v:lang != "C"
  17.   let s:ext = "." . strpart(v:lang, 0, 2)
  18. elseif strlen($LANG) > 0 && $LANG != "C"
  19.   let s:ext = "." . strpart($LANG, 0, 2)
  20. endif
  21.  
  22. " The japanese tutor is available in two encodings, guess which one to use
  23. if s:ext =~? '\.ja'
  24.   if &enc =~ "euc"
  25.     let s:ext = s:ext . ".euc"
  26.   else
  27.     let s:ext = s:ext . ".sjis"
  28.   endif
  29. endif
  30. if s:ext =~? '\.en'
  31.   let s:ext = ""
  32. endif
  33.  
  34. " 2. Build the name of the file:
  35. let s:tutorfile = "/tutor/tutor"
  36. let s:tutorxx = $VIMRUNTIME . s:tutorfile . s:ext
  37.  
  38. " 3. Finding the file:
  39. if filereadable(s:tutorxx)
  40.   let $TUTOR = s:tutorxx
  41. else
  42.   let $TUTOR = $VIMRUNTIME . s:tutorfile
  43.   echo "The file " . s:tutorxx . " does not exist.\n"
  44.   echo "Copying English version: " . $TUTOR
  45.   4sleep
  46. endif
  47.  
  48. " 4. Making the copy and exiting Vim:
  49. e $TUTOR
  50. wq! $TUTORCOPY
  51.